Skip to content

feat: custom css interface#391

Merged
deltork merged 7 commits intomainfrom
dev.del/feat-studio-add-css
Jul 22, 2025
Merged

feat: custom css interface#391
deltork merged 7 commits intomainfrom
dev.del/feat-studio-add-css

Conversation

@deltork
Copy link
Collaborator

@deltork deltork commented Feb 26, 2025

PR Goal?

Allow users to add a custom style sheet to their read along

Fixes?

Feedback sought?

the whole works

Priority?

High, would be nice for the Eric's presentation

Tests added?

Yes

How to test?

You can use the test files
Text: `This is a test.
Sentence.

Paragraph.

Page.`

Audio: https://github.com/ReadAlongs/Studio-Web/raw/refs/heads/dev.del/feat-studio-add-css/packages/studio-web/tests/fixtures/test-sentence-paragraph-page-56k.mp3

Stylesheet: https://raw.githubusercontent.com/ReadAlongs/Studio-Web/refs/heads/dev.del/feat-studio-add-css/packages/studio-web/tests/fixtures/sentence-paragr-cust-css.css

SingleHTML file: https://github.com/ReadAlongs/Studio-Web/raw/refs/heads/dev.del/feat-studio-add-css/packages/studio-web/tests/fixtures/sentence-paragr-cust-css.html

Confidence?

High

Version change?

minor

@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 26, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  packages/studio-web/tests/studio-web/download-web-bundle.spec.ts  58% smaller
  packages/studio-web/tests/test-commands.ts  51% smaller
  packages/studio-web/src/i18n/messages.es.json  43% smaller
  packages/studio-web/src/i18n/messages.fr.json  43% smaller
  packages/studio-web/src/i18n/messages.json  35% smaller
  packages/studio-web/src/app/editor/editor.component.html  24% smaller
  packages/studio-web/src/app/editor/editor.component.ts  2% smaller
  packages/studio-web/src/app/app.module.ts  0% smaller
  packages/studio-web/src/app/demo/demo.component.html  0% smaller
  packages/studio-web/src/app/demo/demo.component.ts  0% smaller
  packages/studio-web/src/app/editor/editor.component.sass Unsupported file format
  packages/studio-web/src/app/shared/download/download.service.ts  0% smaller
  packages/studio-web/src/app/shared/wc-styling/wc-styling-helper.html  0% smaller
  packages/studio-web/src/app/shared/wc-styling/wc-styling.component.html  0% smaller
  packages/studio-web/src/app/shared/wc-styling/wc-styling.component.sass Unsupported file format
  packages/studio-web/src/app/shared/wc-styling/wc-styling.component.spec.ts  0% smaller
  packages/studio-web/src/app/shared/wc-styling/wc-styling.component.ts  0% smaller
  packages/studio-web/src/app/shared/wc-styling/wc-styling.service.ts  0% smaller
  packages/studio-web/src/app/studio/studio.component.ts  0% smaller
  packages/studio-web/tests/editor/custom-css.spec.ts  0% smaller
  packages/studio-web/tests/editor/download-web-bundle.spec.ts  0% smaller
  packages/studio-web/tests/fixtures/CutiveMono-Regular.ttf Unsupported file format
  packages/studio-web/tests/fixtures/cour.ttf Unsupported file format
  packages/studio-web/tests/fixtures/sentence-paragr-cust-css.css  0% smaller
  packages/studio-web/tests/fixtures/sentence-paragr-cust-css.html  0% smaller
  packages/web-component/README.md Unsupported file format
  packages/web-component/src/components.d.ts  0% smaller
  packages/web-component/src/components/read-along-component/read-along.tsx  0% smaller
  packages/web-component/src/components/read-along-component/readme.md Unsupported file format
  packages/web-component/src/scss/modules/_settings.scss Unsupported file format
  update-translations.sh Unsupported file format

@deltork deltork requested a review from joanise February 26, 2025 21:40
@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from cefe021 to 003805f Compare February 27, 2025 14:48
@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2025

PR Preview Action v1.6.2
Preview removed because the pull request was closed.
2025-07-22 18:42 UTC

@deltork deltork requested a review from marctessier February 27, 2025 15:40
@joanise
Copy link
Member

joanise commented Feb 27, 2025

First impressions: this is great, being able to add fonts and styling. In the Editor, it's good to have it shown below the wavesurfer view. In the Studio, I feel it's a bit too much in your face, for something I expect some users will be excited about, and some users will just want to ignore. Could we have an arrow thing to make showing the Styling editor optional, with the default being close in Studio?

@marctessier
Copy link
Collaborator

I ran a couple tests and it works for me and made the interface pink with the example provided in one example :-)

To add a comment , can we have the default pre-written in the window ... For example when I start typing in the CSS section, the "example" provided will erase / I can't copy and paste the "grey" example as the initial template ( If this makes sense what I am saying...)

@deltork
Copy link
Collaborator Author

deltork commented Feb 28, 2025

I ran a couple tests and it works for me and made the interface pink with the example provided in one example :-)

To add a comment , can we have the default pre-written in the window ... For example when I start typing in the CSS section, the "example" provided will erase / I can't copy and paste the "grey" example as the initial template ( If this makes sense what I am saying...)
Thanks for the review !

If you clicked the help button, you would have seen a sample stylesheet.
@joanise should we prefill the style?

@joanise
Copy link
Member

joanise commented Feb 28, 2025

If you clicked the help button, you would have seen a sample stylesheet.
@joanise should we prefill the style?

I would say not by default. By default, the style sheet should be empty. But we could have a button that populates it with the template that has all the things you can specify, that would be really helpful.

@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from 21d0286 to 559fdc0 Compare February 28, 2025 17:06
@deltork deltork marked this pull request as ready for review February 28, 2025 17:22
@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from 559fdc0 to a3b25bb Compare February 28, 2025 18:59
@deltork deltork requested review from joanise and roedoejet February 28, 2025 18:59
@marctessier
Copy link
Collaborator

Looks good from my side!

@joanise
Copy link
Member

joanise commented Feb 28, 2025

As discussed elsewhere, this is good but we would like to do more testing and a more careful review of the code, and maybe polish the interface, so we'll postpone full review merging until after ICLDC.

@joanise joanise force-pushed the dev.del/feat-studio-add-css branch from a3b25bb to 2627d87 Compare April 17, 2025 20:12
@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from 2627d87 to 04c916f Compare June 12, 2025 16:14
@deltork
Copy link
Collaborator Author

deltork commented Jun 13, 2025

@joanise I need translation help

@joanise
Copy link
Member

joanise commented Jun 19, 2025

Hmm, when you have a wide screen but a narrow readalong, the ratio is really weird:
image

There are a number of different screen widths where it's not longer behaving like before, I would like to preserve the nice sizing we had settled on, and have this thing just use a small bit of real estate on the side when it's not expanded.

@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from 296efc6 to d2a4417 Compare June 20, 2025 15:24
@deltork
Copy link
Collaborator Author

deltork commented Jun 20, 2025

Hmm, when you have a wide screen but a narrow readalong, the ratio is really weird: image

There are a number of different screen widths where it's not longer behaving like before, I would like to preserve the nice sizing we had settled on, and have this thing just use a small bit of real estate on the side when it's not expanded.

Did you resize the style window? I have modified the code to reset any resizing after you collapse the window

@deltork deltork force-pushed the dev.del/feat-studio-add-css branch 4 times, most recently from e3cf9d2 to b87540d Compare June 23, 2025 18:09
@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from 856b08d to 9160b88 Compare June 27, 2025 19:47
@deltork deltork requested a review from sergeleger July 4, 2025 20:55
@deltork deltork force-pushed the dev.del/feat-studio-add-css branch 6 times, most recently from 5ad6c27 to 246ae85 Compare July 15, 2025 19:03
Copy link
Collaborator

@roedoejet roedoejet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow — this is a lot of work (and it works!). Nicely done!

I’ve left a few comments — most are very minor — and flagged a couple of smaller UI issues with screenshots that I think we should fix before merging.

One more general thought: I wonder whether it’s worth stepping back for a moment to think about whether building a full-fledged code/CSS editor directly in RAS is the right direction long term. When testing the input area, I found it a bit difficult to edit CSS without syntax highlighting, but adding syntax highlighting might edge us further into scope creep (i.e. developing our own in-browser code editor).

A couple of alternative directions that might be worth considering down the line:

Option A: Rather than having an open CSS input field, we could support uploading CSS files and link users to an external editor (e.g., CodePen) that supports SCSS, syntax highlighting, etc.

Option B: Alternatively, we could narrow the focus to theming (e.g., light/dark foreground/background colours). Users could choose colours via a picker, and we’d generate the CSS under the hood. Not sure if that would fully support your use case, but it might simplify the UX.

To be clear, I’m not suggesting these as replacements for this PR — just possible future directions that could help keep things streamlined while still giving users flexibility. Happy to chat more if helpful!

href="data:application/readalong+xml;base64,${rasB64}"
audio="${b64Audio}"
image-assets-folder=""
${b64Css}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, I'd rather css css-url=${b64Css}

@deltork
Copy link
Collaborator Author

deltork commented Jul 16, 2025

Wow — this is a lot of work (and it works!). Nicely done!

I’ve left a few comments — most are very minor — and flagged a couple of smaller UI issues with screenshots that I think we should fix before merging.

One more general thought: I wonder whether it’s worth stepping back for a moment to think about whether building a full-fledged code/CSS editor directly in RAS is the right direction long term. When testing the input area, I found it a bit difficult to edit CSS without syntax highlighting, but adding syntax highlighting might edge us further into scope creep (i.e. developing our own in-browser code editor).

The point of the editor is to have a way to preview CSS code you are developing with an IDE. There are very good CSS editors available, so we won't attempt to create one. However, after you have created your custom style sheet, you need a way to "quickly" preview your changes that is component seek to do

I will add a copy and paste button so it is easy to transfer the style between your editor and the box.

A couple of alternative directions that might be worth considering down the line:

Option A: Rather than having an open CSS input field, we could support uploading CSS files and link users to an external editor (e.g., CodePen) that supports SCSS, syntax highlighting, etc.

Option B: Alternatively, we could narrow the focus to theming (e.g., light/dark foreground/background colours). Users could choose colours via a picker, and we’d generate the CSS under the hood. Not sure if that would fully support your use case, but it might simplify the UX.

I am in favour of this option as an add-on (feature for the future, step one is #420, then #438). This will be a use case for your basic user, and the advanced user will use the pattern I described above.

To be clear, I’m not suggesting these as replacements for this PR — just possible future directions that could help keep things streamlined while still giving users flexibility. Happy to chat more if helpful!

Thanks for the thoughtful review. I will incorporate the necessary changes!

@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from a08615f to cc5d1bc Compare July 18, 2025 15:10
@deltork deltork requested a review from roedoejet July 18, 2025 15:30
Copy link
Collaborator

@roedoejet roedoejet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, @deltork ! thanks for this

@deltork deltork force-pushed the dev.del/feat-studio-add-css branch 3 times, most recently from 9b1ba5b to 38f9d38 Compare July 21, 2025 14:08
@joanise joanise mentioned this pull request Jul 21, 2025
@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from 38f9d38 to 272300b Compare July 21, 2025 16:03
Copy link
Member

@joanise joanise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready to merge. No need to rebase again, just create a merge commit as is, you're close enough to the tip.

@deltork deltork force-pushed the dev.del/feat-studio-add-css branch from 272300b to 6293099 Compare July 22, 2025 18:30
@deltork deltork merged commit 4566f32 into main Jul 22, 2025
6 checks passed
@deltork deltork deleted the dev.del/feat-studio-add-css branch July 22, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants